package com.tm.car;

import com.tm.car.config.ContentConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;

import java.util.HashMap;

@Slf4j
@SpringBootApplication
@EnableAsync
@EnableWebSocket
@EnableScheduling
public class CarApplication implements ApplicationRunner {

    @Qualifier("thymeleafViewResolver")
    private final ThymeleafViewResolver thymeleafViewResolver;

    public CarApplication(ThymeleafViewResolver thymeleafViewResolver) {
        this.thymeleafViewResolver = thymeleafViewResolver;
    }

    public static void main(String[] args) {
        SpringApplication.run(CarApplication.class, args);
       /* System.out.println("(ლ(´ڡ`ლﾞ 智能充电桩启动成功 ლ(´ڡ`ლ)ﾞ  \n" +
                " ''-'   `'-'    `-..-'              ");*/
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        HashMap<String, String> map = new HashMap<>();
        map.put("projectTitle", ContentConfig.PROJECT_TITLE);
        thymeleafViewResolver.setStaticVariables(map);
        log.info("{智能充电桩}====项目启动成功", ContentConfig.PROJECT_TITLE);


    }
}
